﻿#include "TcpCodec_HeartBeat.h"

#include "RegisterCenter_User.h"

TcpCodec_HeartBeat::TcpCodec_HeartBeat()
{
  setObjectName(getClassNameFirstLow<TcpCodec_HeartBeat>());
}

TcpCodec_HeartBeat::~TcpCodec_HeartBeat()
{

}

DataPackage_TcpCodec* TcpCodec_HeartBeat::decode(DataPackage_TcpCodec* dataPackageInfo_User)
{
  uint userId=dataPackageInfo_User->getUserId();
  logSaver->saveLog("TcpCodec,user "+QString::number(userId)+" heartbeat");
  registerCenter_User->updateLifeTime(userId);
  return dataPackageInfo_User;
}

RegisterCenter_User* TcpCodec_HeartBeat::getRegisterCenter_User()const
{
  return registerCenter_User;
}

TcpCodec_HeartBeat* TcpCodec_HeartBeat::setRegisterCenter_User(RegisterCenter_User*const registerCenter_User)
{
  this->registerCenter_User=registerCenter_User;
  printInjection(this,registerCenter_User);
  return this;
}

void TcpCodec_HeartBeat::objectAutoInjection(QHash<QString,QObject*>* objMap)
{
  setRegisterCenter_User(getObjFromMap<RegisterCenter_User>(objMap));
}
